<!DOCTYPE html>
<%@page import="java.util.ArrayList"%>
<%@page import="mwa.cs.model.Reader"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ include file="../admin/authority.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<%@include file="headScriptRC.jsp"%>
<script type="text/javascript" src="../assets/js/rc/cs51001script.js"></script>
<script>
var vaStatus = '${vaFindStatus}';
var vaCurrentDate = '${vaCurrentDate}';
var vnSumTotal = '${vnSumTotal}';
var vnVatTotal = '${vnVatTotal}';
var vaValidate = '${vaValidate}';
</script>
</head>
<body>
<div class="wrapper">
	<!-- BEGIN Top-Bar -->
	<%@ include file="../fragments/header.jsp" %>
	<!-- END Top-Bar -->
<!-- 	<div class="flim-white"> -->
	<div id="detail-area" class="clearfix">
	<div class="col-sm-12 col-xs-12" >		
			<!--End navigator-bar-->
			<div >	
				<!-- End form-detail -->
				<div class="form-list clearfix" style="margin-bottom:-120px; margin-top:-30px">
					<div class="clearfix">
					<div class="pull-left">
						<h2 style="margin:0px">รับเงินค่าน้ำรายเดี่ยว </h2>
					</div>
				
					<div class="pull-right">
					<form class="form-inline mb-10" role="form" action="CS51001Srvl"  method="post">
						<div style="text-align:right">
							<div class="form-group clearfix">
							<label  for="exampleInputEmail2">BARCODE : </label>
								<input type="text" class="form-control" id="exampleInputEmail2" placeholder="BARCODE">
								<label  for="exampleInputEmail2">ทะเบียนผู้ใช้น้ำ : </label>
								<input type="text" class="form-control" id="inputAccountName" name="inputAccountName" placeholder="ทะเบียนผู้ใช้น้ำ">
								<label  for="exampleInputEmail2" class="ml-5">เลขที่ใบแจ้งหนี้ : </label>
								<input type="text" class="form-control" id="inputBillNumber" name="inputBillNumber" placeholder="เลขที่ใบแจ้งหนี้">
								<input type="hidden"  class="btn btn-primary" name="btn_search_account" id="btn_search_account" value="no">
								<button type="submit" class="btn btn-primary" onclick="checkButtonClick('btn_search_account');"><i class="fa fa-search"></i> ค้นหาผู้ใช้น้ำ</button>
							</div>
						</div>
					</form>
					</div>
					</div>
					<form class="form-horizontal">			
						<div class="clearfix">
							<div class="col-md-6 search-box no-radius" >
							<div class="header-box">รายละเอียดการชำระเงิน </div>
							<div class="row mt-20">
								<div class="col-sm-6"><strong>ทะเบียนผู้ใช้น้ำ</strong> : ${vaAccount}</div>
								<div class="col-sm-6"><strong>วันที่ชำระเงิน</strong> : ${vaCurrentDate}</div>
							</div>
							<div class="row mt-10">
								<div class="col-sm-6"><strong>ชื่อ</strong> : ${vaAccountName}</div>
								<div class="col-sm-6"><strong>ประเภทผู้ใช้น้ำ</strong> : ${vaCustomerClass}</div>
							</div>
							<div class="row mt-10" style="margin-bottom:28px">
								<div class="col-sm-12"><strong>สถานที่ใช้น้ำ</strong> : ${vaCustomerAddress}</div>
							</div>
						
								</div>
							
							<div class="col-md-6 ">
							<div class="search-box no-radius" style="margin-right:-15px">
								<div class="header-box">รายละเอียดการชำระเงิน</div>
								<div class="form-group">
									<label for="inputPassword3" class="col-sm-3 control-label">ชื่อผู้ชำระเงิน <span class="comment">*</span> :</label>
									<div class="col-sm-9">
										<input type="text" class="form-control" id="inputPayerName" name="inputPayerName" placeholder="ชื่อ-สกุล ผู้ชำระเงิน" onblur="setPayNameAndAddress();">
									</div>
								</div>
								<div class="form-group">
									<label for="inputPassword3" class="col-sm-3 control-label">ที่อยู่ผู้ชำระเงิน <span class="comment">*</span> :</label>
									<div class="col-sm-9">
										<textarea class="form-control" rows="2" id="inputPayerAddress" name="inputPayerAddress" placeholder="ที่อยู่ผู้ชำระเงิน" onblur="setPayNameAndAddress();"></textarea>
									</div>
								</div>
							</div>
							</div>
						</div>
						<!-- END row-->
					</form>	
					</div>
				</div>
			<form class="form-inline mb-10" role="form" action="CS51001Srvl"  method="post" onsubmit="return validateFormScreen();">
				<input type="hidden" id="url_address" name="url_address" value="">
				<input type="hidden" id="agent_browser" name="agent_browser" value="">
				<div class="form-list">
					<div class="list-detail-area">
						
						<table class="table-list">
							<tr>
								<th width="5%">รับเงิน</th>
								<th width="15%">รายละเอียด</th>
								<th width="10%">เลขที่ใบแจ้งหนี้</th>
								<th width="10%">วันที่ออกใบแจ้งหนี้</th>
								<th width="7%">ค่าน้ำ</th>
								<th width="7%">ค่าบริการ</th>
								<th width="7%">ค่าภาษี</th>
								<th width="9%">รวมค่าน้ำ</th>
								<th width="7%">ค่าขยะ</th>
								<th width="8%">ค่าบำบัดน้ำเสีย</th>
								<th width="7%">ค่าอื่นๆ</th>
								<th width="8%">รวมทั้งหมด</th>
							</tr>
						<c:forEach var="voArList" items="${voArList}" varStatus="i">  
							<tr class="odd">
								<td><input type="checkbox" class="chkChoose"  id="chkChoose"  name="chkChoose" onclick="calculateOnChecked();" value="${i.count}/${voArList.vaAccount}/${voArList.vaBillNumber}/${voArList.vnWaterCharge}/${voArList.vnWaterFee}/${voArList.vnGarbageCharge}/${voArList.vnWasteWaterCharge}/${voArList.vnOtherCharge}/${voArList.vnVatAmount}/${voArList.vnBillAmount}/${voArList.vnTotalAmount}"/></td>
								<td >ค่าน้ำ</td>
								<td >${voArList.vaBillNumber}</td>
								<td>${voArList.vaAccountReceivableDate}</td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnWaterCharge}" pattern="###,##0.00"/></td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnWaterFee}" pattern="###,##0.00"/></td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnVatAmount}" pattern="###,##0.00"/></td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnBillAmount}" pattern="###,##0.00"/></td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnGarbageCharge}" pattern="###,##0.00"/></td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnWasteWaterCharge}" pattern="###,##0.00"/></td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnOtherCharge}" pattern="###,##0.00"/></td>
								<td style="text-align:right"><fmt:formatNumber value="${voArList.vnTotalAmount}" pattern="###,##0.00"/></td>
							</tr>
						</c:forEach>							
							<tr>
								<td colspan="6" style="text-align:right">รวม</td>
								<td style="text-align:right" class="highlight-blue-2"><span id="vaSpanVatTotal">0</span></td>
								<td style="text-align:right" class="highlight-blue-2"><span id="vaSpanBillAmountTotal">0</span></td>
								<td style="text-align:right"><span id="vaSpanGrabageTotal">0</span></td>
								<td style="text-align:right"><span id="vaSpanWasteWaterTotal">0</span></td>
								<td style="text-align:right"><span id="vaSpanOther">0</span></td>
								<td style="text-align:right" class="highlight-blue-2"><span id="vaSpanSumTotal">0</span></td>
							</tr>
							
							<tr>
								<td colspan="11" style="text-align:right"><input type="text" value="ค่าปรับ"  size="10" style="text-align: right; padding:3px" disabled="disabled" /></td>
								<td style="text-align:right" class="highlight-blue-2"><input type="text" class="form-control text-right" id="inputPenalty" name="inputPenalty"  placeholder="0.00" onblur="calculateOnChecked();"></td>
							</tr>
							
							<tr>
								<td colspan="11" style="text-align:right">รวมทั้งหมด</td>
								<td style="text-align:right; font-size:1.6em" class="highlight-blue-2"><span id="vnSumTotal">0</span></td>
							</tr>	
						</table>
						
					</div>
					<!-- list-detail-area-->
					<div class="text-center mt-10">
						<button type="button" class="btn btn-primary"  data-toggle="modal" data-target="#myModalMessageConfirm"><i class="fa fa-floppy-o"></i> บันทึก</button>
						<input type="hidden"  class="btn btn-danger" name="vaBtn_fresh" id="vaBtn_fresh" value="no">
						<button type="submit" class="btn btn-primary"  onClick="window.location.reload()"><i class="fa fa-refresh"></i> เริ่มใหม่</button>
						<input type="hidden"  class="btn btn-danger" name="btn_closePage" id="btn_closePage" value="no">
						<button type="button" class="btn btn-danger" onclick="goBackHistory(${vnClick});"><i class="fa fa-times"></i> ปิดหน้ารับเงิน</button>
					</div>
					<!--hide data-->
					<input type="hidden" name="vaHidePayerName" id="vaHidePayerName" value="GG"/>
					<input type="hidden" name="vaHideAddress" id="vaHideAddress" value="G"/>	
				</div>
				
				<!-- message confirm  of button save -->
				<div class="modal fade" id="myModalMessageConfirm">
				  <div class="modal-dialog" style="width:400px">
				    <div class="modal-content">
				       <div class="modal-header">
				        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				        <h4 class="modal-title">รับเงินค่าน้ำรายเดี่ยว</h4>
				      </div>
				      <div class="modal-body" >
				        <p><span class="fa-stack fa-lg mr-10" style=" color:#FC0"> <i class="fa fa-exclamation-triangle fa-stack-2x"></i></span> ยืนยันการรับเงินค่าน้ำรายเดี่ยว  </p>
				      </div>
				      <div class="modal-footer">
						<input type="hidden"  class="btn btn-primary" name="btn_save" id="btn_save" value="no">
						<button type="submit" class="btn btn-primary" onclick="checkButtonClick('btn_save');"><i class="fa fa-floppy-o"></i> บันทึก</button>
						<button type="button" class="btn btn-danger" data-dismiss="modal"><i class="glyphicon glyphicon-floppy-remove"></i> ยกเลิก</button>
				      </div>
				    </div><!-- /.modal-content -->
				  </div><!-- /.modal-dialog -->
				</div><!-- /.modal -->
				</form><br/><br/>
				<!-- End Form-list --> 			
			</div>
			<!-- End detail-area -->		
		</div>
		</div>
	<!-- End Detail-area--> 	
<!-- </div> -->
<!-- End Wrapper --> 
			<!-- Message Result Find Data -->
				<div class="modal fade" id="myModalMessage">
					<div class="modal-dialog" style="width:400px">
				    	<div class="modal-content">
				      		<div class="modal-header">
				        		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				        		<h4 class="modal-title">รับเงินค่าน้ำรายเดี่ยว</h4>
				      		</div>
				      		<div class="modal-body">
				        		<p><span class="fa-stack fa-lg mr-10" style=" color:#FC0"> <i class="fa fa-exclamation-triangle fa-stack-2x"></i></span>ไม่พบรายการที่ค้นหา</p>
				      		</div>
				      		<div class="modal-footer" style="text-align: center;">
				        		<button type="button" class="btn btn-primary" data-dismiss="modal"><i class="glyphicon glyphicon-ok"></i> ตกลง</button>
				      		</div>
				    	</div>
				  	</div>
				</div><!-- /.modal -->

			<!-- Error Massage Validate Result-->
				<div class="modal fade" id="myModalValidateError">
					<div class="modal-dialog" style="width:400px">
				    	<div class="modal-content">
				      		<div class="modal-header">
				        		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				        		<h4 class="modal-title">เกิดข้อผิดพลาด</h4>
				      		</div>
				      		<div class="modal-body">
				        		<p><span class="fa-stack fa-lg mr-10" style=" color:#FC0"> <i class="fa fa-exclamation-triangle fa-stack-2x"></i></span>
				        		<span id="vaSpanErrorMsg">กรุณากรอกข้อมูลให้ครบถ้วน</span>
				        		</p>
				      		</div>
				      		<div class="modal-footer" style="text-align: center;">
				        		<button type="button" class="btn btn-primary" data-dismiss="modal"><i class="glyphicon glyphicon-ok"></i> ตกลง</button>
				      		</div>
				    	</div>
				  	</div>
				</div><!-- /.modal -->
</body>
</html>